package leetcode.weekly.week329;

//Solution3Test
public class Solution5 {

	public boolean makeStringsEqual(String s, String target) {
		int zero = 0, one = 0;
		int n = s.length();
		for (int i = 0; i < n; i++) {
			char cs = s.charAt(i);
			if (cs == '0') {
				zero++;
			} else {
				one++;
			}
		}
		for (int i = 0; i < n; i++) {
			char cs = s.charAt(i);
			char ct = target.charAt(i);
			if (cs == ct) {
				continue;
			}
			if (cs == '0') {
				if (one > 0) {
					one += 1;
					zero -= 1;
				} else {
					return false;
				}
			} else {
				if (one > 1) {
					one -= 1;
					zero += 1;
				} else if (zero > 0) {
						
				}
			}
		}
		return true;
	}
}
